// Copyright 2020 Google LLC All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This code was autogenerated. Do not edit directly.
// This file is generated. Do not edit
// @generated

// https://github.com/Manishearth/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]

#![cfg_attr(rustfmt, rustfmt_skip)]

#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unsafe_code)]
#![allow(unused_imports)]
#![allow(unused_results)]

const METHOD_SDK_PLAYER_CONNECT: ::grpcio::Method<super::alpha::PlayerID, super::alpha::Bool> = ::grpcio::Method {
    ty: ::grpcio::MethodType::Unary,
    name: "/agones.dev.sdk.alpha.SDK/PlayerConnect",
    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
};

const METHOD_SDK_PLAYER_DISCONNECT: ::grpcio::Method<super::alpha::PlayerID, super::alpha::Bool> = ::grpcio::Method {
    ty: ::grpcio::MethodType::Unary,
    name: "/agones.dev.sdk.alpha.SDK/PlayerDisconnect",
    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
};

const METHOD_SDK_SET_PLAYER_CAPACITY: ::grpcio::Method<super::alpha::Count, super::alpha::Empty> = ::grpcio::Method {
    ty: ::grpcio::MethodType::Unary,
    name: "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity",
    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
};

const METHOD_SDK_GET_PLAYER_CAPACITY: ::grpcio::Method<super::alpha::Empty, super::alpha::Count> = ::grpcio::Method {
    ty: ::grpcio::MethodType::Unary,
    name: "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity",
    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
};

const METHOD_SDK_GET_PLAYER_COUNT: ::grpcio::Method<super::alpha::Empty, super::alpha::Count> = ::grpcio::Method {
    ty: ::grpcio::MethodType::Unary,
    name: "/agones.dev.sdk.alpha.SDK/GetPlayerCount",
    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
};

const METHOD_SDK_IS_PLAYER_CONNECTED: ::grpcio::Method<super::alpha::PlayerID, super::alpha::Bool> = ::grpcio::Method {
    ty: ::grpcio::MethodType::Unary,
    name: "/agones.dev.sdk.alpha.SDK/IsPlayerConnected",
    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
};

const METHOD_SDK_GET_CONNECTED_PLAYERS: ::grpcio::Method<super::alpha::Empty, super::alpha::PlayerIDList> = ::grpcio::Method {
    ty: ::grpcio::MethodType::Unary,
    name: "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers",
    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
};

#[derive(Clone)]
pub struct SdkClient {
    client: ::grpcio::Client,
}

impl SdkClient {
    pub fn new(channel: ::grpcio::Channel) -> Self {
        SdkClient {
            client: ::grpcio::Client::new(channel),
        }
    }

    pub fn player_connect_opt(&self, req: &super::alpha::PlayerID, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::alpha::Bool> {
        self.client.unary_call(&METHOD_SDK_PLAYER_CONNECT, req, opt)
    }

    pub fn player_connect(&self, req: &super::alpha::PlayerID) -> ::grpcio::Result<super::alpha::Bool> {
        self.player_connect_opt(req, ::grpcio::CallOption::default())
    }

    pub fn player_connect_async_opt(&self, req: &super::alpha::PlayerID, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Bool>> {
        self.client.unary_call_async(&METHOD_SDK_PLAYER_CONNECT, req, opt)
    }

    pub fn player_connect_async(&self, req: &super::alpha::PlayerID) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Bool>> {
        self.player_connect_async_opt(req, ::grpcio::CallOption::default())
    }

    pub fn player_disconnect_opt(&self, req: &super::alpha::PlayerID, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::alpha::Bool> {
        self.client.unary_call(&METHOD_SDK_PLAYER_DISCONNECT, req, opt)
    }

    pub fn player_disconnect(&self, req: &super::alpha::PlayerID) -> ::grpcio::Result<super::alpha::Bool> {
        self.player_disconnect_opt(req, ::grpcio::CallOption::default())
    }

    pub fn player_disconnect_async_opt(&self, req: &super::alpha::PlayerID, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Bool>> {
        self.client.unary_call_async(&METHOD_SDK_PLAYER_DISCONNECT, req, opt)
    }

    pub fn player_disconnect_async(&self, req: &super::alpha::PlayerID) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Bool>> {
        self.player_disconnect_async_opt(req, ::grpcio::CallOption::default())
    }

    pub fn set_player_capacity_opt(&self, req: &super::alpha::Count, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::alpha::Empty> {
        self.client.unary_call(&METHOD_SDK_SET_PLAYER_CAPACITY, req, opt)
    }

    pub fn set_player_capacity(&self, req: &super::alpha::Count) -> ::grpcio::Result<super::alpha::Empty> {
        self.set_player_capacity_opt(req, ::grpcio::CallOption::default())
    }

    pub fn set_player_capacity_async_opt(&self, req: &super::alpha::Count, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Empty>> {
        self.client.unary_call_async(&METHOD_SDK_SET_PLAYER_CAPACITY, req, opt)
    }

    pub fn set_player_capacity_async(&self, req: &super::alpha::Count) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Empty>> {
        self.set_player_capacity_async_opt(req, ::grpcio::CallOption::default())
    }

    pub fn get_player_capacity_opt(&self, req: &super::alpha::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::alpha::Count> {
        self.client.unary_call(&METHOD_SDK_GET_PLAYER_CAPACITY, req, opt)
    }

    pub fn get_player_capacity(&self, req: &super::alpha::Empty) -> ::grpcio::Result<super::alpha::Count> {
        self.get_player_capacity_opt(req, ::grpcio::CallOption::default())
    }

    pub fn get_player_capacity_async_opt(&self, req: &super::alpha::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Count>> {
        self.client.unary_call_async(&METHOD_SDK_GET_PLAYER_CAPACITY, req, opt)
    }

    pub fn get_player_capacity_async(&self, req: &super::alpha::Empty) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Count>> {
        self.get_player_capacity_async_opt(req, ::grpcio::CallOption::default())
    }

    pub fn get_player_count_opt(&self, req: &super::alpha::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::alpha::Count> {
        self.client.unary_call(&METHOD_SDK_GET_PLAYER_COUNT, req, opt)
    }

    pub fn get_player_count(&self, req: &super::alpha::Empty) -> ::grpcio::Result<super::alpha::Count> {
        self.get_player_count_opt(req, ::grpcio::CallOption::default())
    }

    pub fn get_player_count_async_opt(&self, req: &super::alpha::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Count>> {
        self.client.unary_call_async(&METHOD_SDK_GET_PLAYER_COUNT, req, opt)
    }

    pub fn get_player_count_async(&self, req: &super::alpha::Empty) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Count>> {
        self.get_player_count_async_opt(req, ::grpcio::CallOption::default())
    }

    pub fn is_player_connected_opt(&self, req: &super::alpha::PlayerID, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::alpha::Bool> {
        self.client.unary_call(&METHOD_SDK_IS_PLAYER_CONNECTED, req, opt)
    }

    pub fn is_player_connected(&self, req: &super::alpha::PlayerID) -> ::grpcio::Result<super::alpha::Bool> {
        self.is_player_connected_opt(req, ::grpcio::CallOption::default())
    }

    pub fn is_player_connected_async_opt(&self, req: &super::alpha::PlayerID, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Bool>> {
        self.client.unary_call_async(&METHOD_SDK_IS_PLAYER_CONNECTED, req, opt)
    }

    pub fn is_player_connected_async(&self, req: &super::alpha::PlayerID) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::Bool>> {
        self.is_player_connected_async_opt(req, ::grpcio::CallOption::default())
    }

    pub fn get_connected_players_opt(&self, req: &super::alpha::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::alpha::PlayerIDList> {
        self.client.unary_call(&METHOD_SDK_GET_CONNECTED_PLAYERS, req, opt)
    }

    pub fn get_connected_players(&self, req: &super::alpha::Empty) -> ::grpcio::Result<super::alpha::PlayerIDList> {
        self.get_connected_players_opt(req, ::grpcio::CallOption::default())
    }

    pub fn get_connected_players_async_opt(&self, req: &super::alpha::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::PlayerIDList>> {
        self.client.unary_call_async(&METHOD_SDK_GET_CONNECTED_PLAYERS, req, opt)
    }

    pub fn get_connected_players_async(&self, req: &super::alpha::Empty) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::alpha::PlayerIDList>> {
        self.get_connected_players_async_opt(req, ::grpcio::CallOption::default())
    }
    pub fn spawn<F>(&self, f: F) where F: ::futures::Future<Output = ()> + Send + 'static {
        self.client.spawn(f)
    }
}

pub trait Sdk {
    fn player_connect(&mut self, ctx: ::grpcio::RpcContext, req: super::alpha::PlayerID, sink: ::grpcio::UnarySink<super::alpha::Bool>);
    fn player_disconnect(&mut self, ctx: ::grpcio::RpcContext, req: super::alpha::PlayerID, sink: ::grpcio::UnarySink<super::alpha::Bool>);
    fn set_player_capacity(&mut self, ctx: ::grpcio::RpcContext, req: super::alpha::Count, sink: ::grpcio::UnarySink<super::alpha::Empty>);
    fn get_player_capacity(&mut self, ctx: ::grpcio::RpcContext, req: super::alpha::Empty, sink: ::grpcio::UnarySink<super::alpha::Count>);
    fn get_player_count(&mut self, ctx: ::grpcio::RpcContext, req: super::alpha::Empty, sink: ::grpcio::UnarySink<super::alpha::Count>);
    fn is_player_connected(&mut self, ctx: ::grpcio::RpcContext, req: super::alpha::PlayerID, sink: ::grpcio::UnarySink<super::alpha::Bool>);
    fn get_connected_players(&mut self, ctx: ::grpcio::RpcContext, req: super::alpha::Empty, sink: ::grpcio::UnarySink<super::alpha::PlayerIDList>);
}

pub fn create_sdk<S: Sdk + Send + Clone + 'static>(s: S) -> ::grpcio::Service {
    let mut builder = ::grpcio::ServiceBuilder::new();
    let mut instance = s.clone();
    builder = builder.add_unary_handler(&METHOD_SDK_PLAYER_CONNECT, move |ctx, req, resp| {
        instance.player_connect(ctx, req, resp)
    });
    let mut instance = s.clone();
    builder = builder.add_unary_handler(&METHOD_SDK_PLAYER_DISCONNECT, move |ctx, req, resp| {
        instance.player_disconnect(ctx, req, resp)
    });
    let mut instance = s.clone();
    builder = builder.add_unary_handler(&METHOD_SDK_SET_PLAYER_CAPACITY, move |ctx, req, resp| {
        instance.set_player_capacity(ctx, req, resp)
    });
    let mut instance = s.clone();
    builder = builder.add_unary_handler(&METHOD_SDK_GET_PLAYER_CAPACITY, move |ctx, req, resp| {
        instance.get_player_capacity(ctx, req, resp)
    });
    let mut instance = s.clone();
    builder = builder.add_unary_handler(&METHOD_SDK_GET_PLAYER_COUNT, move |ctx, req, resp| {
        instance.get_player_count(ctx, req, resp)
    });
    let mut instance = s.clone();
    builder = builder.add_unary_handler(&METHOD_SDK_IS_PLAYER_CONNECTED, move |ctx, req, resp| {
        instance.is_player_connected(ctx, req, resp)
    });
    let mut instance = s;
    builder = builder.add_unary_handler(&METHOD_SDK_GET_CONNECTED_PLAYERS, move |ctx, req, resp| {
        instance.get_connected_players(ctx, req, resp)
    });
    builder.build()
}
